#include "widget_test.h"
#include "wnd_widget.h"
#include "minigui_test.h"
#include "wnd_handle.h"
#include <math.h>






int WIDGET_TEST_MainPRoc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
    HDC u32DevCent;
	/**
	 * @brief 获取附加数据
	 */
	WND_WIDGET_S *pstWnd = (WND_WIDGET_S *)GetWindowAdditionalData(u32Wnd);
	int s32Num;

    switch (s32Message) {
		case MSG_CREATE:
			pstWnd->stCommon.stAttr.u32WndId = u32Wnd;
			if(pstWnd) {
				for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
					WND_WIDGET_Create(&pstWnd->pstWidget[s32Num], pstWnd->stCommon.stAttr.u32WndId);
				}
			}

		break;

        case MSG_PAINT:
           	u32DevCent = BeginPaint(u32Wnd);
			if(pstWnd) {
				TextOut(u32DevCent, 40, 40, pstWnd->stCommon.stAttr.s8Name);
			}
            EndPaint (u32Wnd, u32DevCent);
        	return 0;
        case MSG_CLOSE:
			QLOG(TDBG, "主界面 [%s] 结束\n", pstWnd->stCommon.stAttr.s8Name);
            DestroyMainWindow (u32Wnd);
            PostQuitMessage (u32Wnd);
            return 0;
    }

    return DefaultMainWinProc(u32Wnd, s32Message, u32Param, u64Param);
}


WND_WIDGET_S stGlbMainWindowTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "测试主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_LIGHTWHITE_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	///.pstWidget = stGlbMainWndCtrl,
	///.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),

};


void WIDGET_TEST_MainWnd()
{
	WND_WIDGET_Create(&stGlbMainWindowTest, 0);

}

















int WIDGET_TEST_ButtonMainPRoc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
    HDC u32DevCent;

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S *)GetWindowAdditionalData(u32Wnd);
	int s32Num;

    switch (s32Message) {
		case MSG_CREATE:
			pstWnd->stCommon.stAttr.u32WndId = u32Wnd;
			if(pstWnd) {
				for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
					WND_WIDGET_Create(&pstWnd->pstWidget[s32Num], pstWnd->stCommon.stAttr.u32WndId);
				}
			}

		break;

        case MSG_PAINT:
           	u32DevCent = BeginPaint(u32Wnd);
			TextOut(u32DevCent, 40, 40, "测试主界面");
            EndPaint (u32Wnd, u32DevCent);
        	return 0;
        case MSG_CLOSE:
			QLOG(TDBG, "结束主界面\n");
            DestroyMainWindow (u32Wnd);
            PostQuitMessage (u32Wnd);
            return 0;
    }

    return DefaultMainWinProc(u32Wnd, s32Message, u32Param, u64Param);
}

int WIDGET_TEST_ButtonProc1(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "按钮1被点击\n");
	SetWindowElementAttr(u32Wnd, WE_FGC_WINDOW, 0xfff00fff);
	return 0;
}

int WIDGET_TEST_ButtonProc2(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "按钮2被点击\n");
	HDC u32Hdc = GetDC(u32Wnd);
	//SetWindowElementAttr(u32Wnd, WE_FGC_WINDOW, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));
	//SetWindowElementAttr(u32Wnd, WE_BGC_WINDOW, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));
	//SetWindowElementAttr(u32Wnd, WE_FGC_ACTIVE_WND_BORDER, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));
	//SetWindowElementAttr(u32Wnd, WE_FONT_TOOLTIP, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));
	//SetWindowElementAttr(u32Wnd, WE_FGC_TOOLTIP, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));
	//SetWindowElementAttr(u32Wnd, WE_BGC_TOOLTIP, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));
	//SetWindowElementAttr(u32Wnd, WE_FONT_CAPTION, Pixel2DWORD(u32Hdc, RGB2Pixel(u32Hdc, 0xFF, 0x00, 0x00)));

	//SetWindowElementAttr(u32Wnd, WE_METRICS_WND_BORDER, 500);


	//SetTextColor(u32Hdc, RGB2Pixel(u32Hdc, 0xF, 0x00, 0x00));

	UpdateWindow(u32Wnd, false);
	//SetWindowElementColorEx(pshwnd,WED_3DBOX_REVERSE,COLOR_red );
	//SetWindowElementColorEx(pshwnd, FGC_CONTROL_NORMAL,COLOR_red );

	ReleaseDC (u32Hdc);

	//SetWindowBkColor(u32Wnd, COLOR_darkyellow);
	return 0;
}



WND_WIDGET_S stGlbButtonWndTest[] = {
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮1",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_DARKCYAN_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc1,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮2",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc2,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},

};


WND_WIDGET_S stGlbButtonMainWindowTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "测试主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_ButtonMainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbButtonWndTest,
	.s32WidgetNum = sizeof(stGlbButtonWndTest) / sizeof(stGlbButtonWndTest[0]),

};

void WIDGET_TEST_Button()
{

	WND_WIDGET_Create(&stGlbButtonMainWindowTest, 0);
}

















#if 0
int WIDGET_TEST_PictureButtonMainPRoc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
    HDC u32DevCent;

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S *)GetWindowAdditionalData(u32Wnd);
	int s32Num;
	//unsigned int u32WndWidth, u32Height;

	//WND_WIDGET_S *pstCtrl = NULL;


    switch (s32Message) {
		case MSG_CREATE:
			pstWnd->stCommon.stAttr.u32WndId = u32Wnd;
			if(pstWnd) {
				for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
					//pstCtrl = &pstWnd->pstWidget[s32Num];
					WND_WIDGET_Create(&pstWnd->pstWidget[s32Num], pstWnd->stCommon.stAttr.u32WndId);
				}
			}

		break;

        case MSG_PAINT:
           	u32DevCent = BeginPaint(u32Wnd);
			TextOut(u32DevCent, 40, 40, "测试主界面");
            EndPaint (u32Wnd, u32DevCent);
        	return 0;
        case MSG_CLOSE:
			QLOG(TDBG, "结束主界面\n");
            DestroyMainWindow (u32Wnd);
            PostQuitMessage (u32Wnd);
            return 0;
    }

    return DefaultMainWinProc(u32Wnd, s32Message, u32Param, u64Param);
}
#endif

int WIDGET_TEST_PictureButtonProc1(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "图片按钮1被点击\n");
	return 0;
}

int WIDGET_TEST_PictureButtonProc2(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "图片按钮2被点击\n");
	return 0;
}



WND_WIDGET_S stGlbPictureButtonWndTest[] = {
	{
		.enType = WND_WIDGET_TYPE_PICTURE_BUTTON_E,
		.unPrivate = {
			.stPictureButton = {
				.s32RealSizeImage = 1,
				.s8MapPath = "share/res/png/menu/单面画-黄.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "图片按钮1",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_PictureButtonProc1,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_PICTURE_BUTTON_E,
		.unPrivate = {
			.stPictureButton = {
				.s32RealSizeImage = 0,
				//.s8MapPath = "sample/res/mouse.png",
				.s8MapPath = "share/res/png/menu/设备管理-黄.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "图片按钮2",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_TRANSPARENT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_PictureButtonProc2,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},

};


WND_WIDGET_S stGlbPictureButtonMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "图片按钮主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbPictureButtonWndTest,
	.s32WidgetNum = sizeof(stGlbPictureButtonWndTest) / sizeof(stGlbPictureButtonWndTest[0]),

};

void WIDGET_TEST_PictureButton()
{

	WND_WIDGET_Create(&stGlbPictureButtonMainWndTest, 0);
}












#if 0

int WIDGET_TEST_MultiButtonMainProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
    HDC u32DevCent;

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S *)GetWindowAdditionalData(u32Wnd);
	int s32Num;
	//unsigned int u32WndWidth, u32Height;

	//WND_WIDGET_S *pstCtrl = NULL;


    switch (s32Message) {
		case MSG_CREATE:
			pstWnd->stCommon.stAttr.u32WndId = u32Wnd;
			if(pstWnd) {
				for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
					//pstCtrl = &pstWnd->pstWidget[s32Num];
					WND_WIDGET_Create(&pstWnd->pstWidget[s32Num], pstWnd->stCommon.stAttr.u32WndId);
				}
			}

		break;

        case MSG_PAINT:
           	u32DevCent = BeginPaint(u32Wnd);
			TextOut(u32DevCent, 40, 40, "测试主界面");
            EndPaint (u32Wnd, u32DevCent);
        	return 0;
        case MSG_CLOSE:
			QLOG(TDBG, "结束主界面\n");
            DestroyMainWindow (u32Wnd);
            PostQuitMessage (u32Wnd);
            return 0;
    }

    return DefaultMainWinProc(u32Wnd, s32Message, u32Param, u64Param);
}
#endif

int WIDGET_TEST_MultiButtonProc1(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "多选按钮1被点击\n");

	return 0;
}

int WIDGET_TEST_MultiButtonProc2(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "多选按钮2被点击\n");
	return 0;
}

int WIDGET_TEST_MultiButtonProc3(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "多选按钮3被点击\n");
	return 0;
}

int WIDGET_TEST_MultiButtonProc4(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "多选按钮4被点击\n");
	return 0;
}

int WIDGET_TEST_MultiButtonProc5(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "多选按钮5被点击\n");
	return 0;
}



int WIDGET_TEST_MultiGetStaButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "获取状态按钮被点击\n");
	int s32Num;
	int s32MultiSta;
	char s8MultiSta[64];

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);


	for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
		if(pstWnd->pstWidget[s32Num].enType == WND_WIDGET_TYPE_MULTI_BUTTON_E) {
		//if(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32Group == WIDGET_TEST_MULTI_GROUP) {
			s32MultiSta = MINI_INTF_GetiButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId);
			if(s32MultiSta == BST_UNCHECKED) {
				snprintf(s8MultiSta, sizeof(s8MultiSta), "未被选中");
			} else if(s32MultiSta == BST_CHECKED) {
				snprintf(s8MultiSta, sizeof(s8MultiSta), "被选中");
			}  else if(s32MultiSta == BST_INDETERMINATE) {
				snprintf(s8MultiSta, sizeof(s8MultiSta), "不可被选中");
			}

			SLOG(TDBG, "获取到 [%s] 的状态为[%s]\n",
				pstWnd->pstWidget[s32Num].stCommon.stAttr.s8Name,
				s8MultiSta);
		}
	}
	//MINI_INTF_SetButtonCheck(unsigned int u32WndId);
	return 0;
}


int WIDGET_TEST_MultiSetStaButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "获取状态按钮被点击\n");
	int s32Num;

	static unsigned int u32Sta = 0;

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);


	/* 设置复选按钮状态*/
	for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
		if(pstWnd->pstWidget[s32Num].enType == WND_WIDGET_TYPE_MULTI_BUTTON_E) {
			//if(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32Group == WIDGET_TEST_MULTI_GROUP) {
			if((u32Sta % 3) == 0) {
				MINI_INTF_SetButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId, BST_CHECKED);
			} else if((u32Sta % 3) == 1){
				MINI_INTF_SetButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId, BST_INDETERMINATE);
			} else if((u32Sta % 3) == 2){
				MINI_INTF_SetButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId, BST_UNCHECKED);
			}
		}
	}


	u32Sta++;

	return 0;
}



WND_WIDGET_S stGlbMultiButtonWndTest[] = {
	{
		.enType = WND_WIDGET_TYPE_MULTI_BUTTON_E,
		.unPrivate = {
			.stMultiButton = {
				.s32AutoCheck = 0,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "多选按钮1",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiButtonProc1,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_MULTI_BUTTON_E,
		.unPrivate = {
			.stMultiButton = {
				.s32AutoCheck = 1,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "多选按钮2",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiButtonProc2,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_MULTI_BUTTON_E,
		.unPrivate = {
			.stMultiButton = {
				.s32AutoCheck = 2,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "多选按钮3",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*3)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiButtonProc3,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_MULTI_BUTTON_E,
		.unPrivate = {
			.stMultiButton = {
				.s32AutoCheck = 3,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "多选按钮4",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*4)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiButtonProc4,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_MULTI_BUTTON_E,
		.unPrivate = {
			.stMultiButton = {
				.s32AutoCheck = 3,
				.s32LeftText = 1,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "多选按钮5",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*5)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiButtonProc5,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},

	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "获取状态",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiGetStaButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "设置状态",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*3)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_MultiSetStaButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},

};


WND_WIDGET_S stGlbMultiButtonMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "多选按钮主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbMultiButtonWndTest,
	.s32WidgetNum = sizeof(stGlbMultiButtonWndTest) / sizeof(stGlbMultiButtonWndTest[0]),

};

void WIDGET_TEST_MultiButton(void)
{

	WND_WIDGET_Create(&stGlbMultiButtonMainWndTest, 0);
}

























int WIDGET_TEST_RadioButtonProc1(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "单选按钮1被点击\n");
	return 0;
}

int WIDGET_TEST_RadioButtonProc2(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "单选按钮2被点击\n");
	return 0;
}

int WIDGET_TEST_RadioButtonProc3(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "单选按钮3被点击\n");
	return 0;
}

int WIDGET_TEST_RadioGetStaButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "获取状态按钮被点击\n");
	int s32Num;
	int s32MultiSta;
	char s8MultiSta[64];

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);


	for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {

		if(pstWnd->pstWidget[s32Num].enType == WND_WIDGET_TYPE_RADIO_BUTTON_E) {
		//if(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32Group == WIDGET_TEST_MULTI_GROUP) {
			s32MultiSta = MINI_INTF_GetiButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId);
			memset(s8MultiSta, 0, sizeof(s8MultiSta));
			if(s32MultiSta == BST_UNCHECKED) {
				snprintf(s8MultiSta, sizeof(s8MultiSta), "未被选中");
			} else if(s32MultiSta == BST_CHECKED) {
				snprintf(s8MultiSta, sizeof(s8MultiSta), "被选中");
			}  else if(s32MultiSta == BST_INDETERMINATE) {
				snprintf(s8MultiSta, sizeof(s8MultiSta), "不可被选中");
			}

			SLOG(TDBG, "获取到 [%s] 的状态为[%s] [%d]\n",
				pstWnd->pstWidget[s32Num].stCommon.stAttr.s8Name,
				s8MultiSta, s32MultiSta);
		}
	}
	//MINI_INTF_SetButtonCheck(unsigned int u32WndId);
	return 0;
}


int WIDGET_TEST_RadioSetStaButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "获取状态按钮被点击\n");
	int s32Num;


	static unsigned int u32Sta = 0;

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);


	/* 设置按钮状态 虽然设置了所有的按钮，但是如果是设置为选中的话只有一个生效，因为一组单选里面只有一个才能生效*/
	for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
		if(pstWnd->pstWidget[s32Num].enType == WND_WIDGET_TYPE_RADIO_BUTTON_E) {
			//if(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32Group == WIDGET_TEST_MULTI_GROUP) {
			if((u32Sta % 3) == 0) {
				MINI_INTF_SetButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId, BST_CHECKED);
			}else if((u32Sta % 3) == 1){
				MINI_INTF_SetButtonCheck(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId, BST_UNCHECKED);
			}
		}
	}


	u32Sta++;

	return 0;
}


WND_WIDGET_S stGlbRadioButtonWndTest[] = {
	{
		.enType = WND_WIDGET_TYPE_RADIO_BUTTON_E,
		.unPrivate = {
			.stRadioButton = {
				.s32AutoCheck = 1,
				.s32GroupSta = 1,
				.s32PushLike = 1,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "单选按钮1",
				.u32WndId = 1,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_RadioButtonProc1,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_RADIO_BUTTON_E,
		.unPrivate = {
			.stRadioButton = {
				.s32AutoCheck = 1,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "单选按钮2",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_RadioButtonProc2,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_RADIO_BUTTON_E,
		.unPrivate = {
			.stRadioButton = {
				.s32AutoCheck = 1,
				.s32LeftText = 1,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "单选按钮3",
				.u32WndId = 0,
				.u32Group = WIDGET_TEST_MULTI_GROUP,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*3)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_RadioButtonProc3,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},


#if 1
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "获取状态",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_RadioGetStaButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "设置状态",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*3)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_RadioSetStaButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
#endif
};





WND_WIDGET_S stGlbRadioButtonMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "单选按钮主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbRadioButtonWndTest,
	.s32WidgetNum = sizeof(stGlbRadioButtonWndTest) / sizeof(stGlbRadioButtonWndTest[0]),

};

void WIDGET_TEST_RadioButton(void)
{

	WND_WIDGET_Create(&stGlbRadioButtonMainWndTest, 0);
}
















int WIDGET_TEST_DlgMainButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "获取状态按钮被点击\n");
	int s32Num;



	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(u32Wnd);
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);




	if(pstWnd) {
		for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
			SLOG(TDBG, "创建 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);
			WND_WIDGET_Create(&pstWnd->pstWidget[s32Num], pstWnd->stCommon.stAttr.u32WndId);
		}

	}

	return 0;
}


static int WIDGET_TEST_DlgProc(HWND hDlg, int message, WPARAM wParam, LPARAM lParam)
{
	int s32Num;
	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(hDlg);

	switch (message){
	case MSG_INITDIALOG:
	{
		SLOG(TDBG, "对话框 [%s] 初始化\n", pstWnd->stCommon.stAttr.s8Name);
		if(pstWnd) {
			for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
				//WND_WIDGET_Create(&pstWnd->pstWidget[s32Num], pstWnd->stCommon.stAttr.u32WndId);
				if(pstWnd->pstWidget[s32Num].stCommon.stFops.CallBackByVoid) {
					QLOG(TDBG, "对话框 [%s] 注册回调函数\n", pstWnd->pstWidget[s32Num].stCommon.stAttr.s8Name);
					SetNotificationCallback(GetDlgItem(hDlg, pstWnd->pstWidget[s32Num].stCommon.stAttr.u32Id),
							pstWnd->pstWidget[s32Num].stCommon.stFops.CallBackByVoid);
				}
			}
		}
		break;
	}
	break;
	case MSG_CLOSE:
		QLOG(TDBG, "对话框结束\n");
		EndDialog(hDlg, 0);
		return 0;
	}
	return DefaultDialogProc(hDlg, message, wParam, lParam);
}


int WIDGET_TEST_OnDlgTestButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "测试对话框命令\n");

	return 0;
}

int WIDGET_TEST_OnDlgEndButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "结束对话框\n");

	SendMessage(GetParent(u32Wnd), MSG_CLOSE, 0, 0);
	return 0;
}


WND_WIDGET_S stGlbOnDlgCtrlWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,		/* 这里才是重点*/
		.stCommon = {
			.stAttr = {
				.s8Name = "测试",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 15,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_OnDlgTestButtonProc,
			},
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,		/* 这里才是重点*/
		.stCommon = {
			.stAttr = {
				.s8Name = "结束",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 16,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_OnDlgEndButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},

};


WND_WIDGET_S stGlbDlgWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_DLG_E,		/* 这里才是重点*/
		.stCommon = {
			.stAttr = {
				.s8Name = "对话框",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 10,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_RED_E,
				.bShowNow = true,
				.bBorder = true,
				.bCaption = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DlgProc,
			},
			//WND_STA_S stSta;
		},

		.pstWidget = stGlbOnDlgCtrlWndTest,
		.s32WidgetNum = sizeof(stGlbOnDlgCtrlWndTest) / sizeof(stGlbOnDlgCtrlWndTest[0]),
	},

};

WND_WIDGET_S stGlbDlgMainButtonWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "开始对话框",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DlgMainButtonProc,
			},
			//WND_STA_S stSta;
		},

		.pstWidget = stGlbDlgWndTest,
		.s32WidgetNum = sizeof(stGlbDlgWndTest) / sizeof(stGlbDlgWndTest[0]),
	},

};






WND_WIDGET_S stGlbDlgMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "对话框主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbDlgMainButtonWndTest,
	.s32WidgetNum = sizeof(stGlbDlgMainButtonWndTest) / sizeof(stGlbDlgMainButtonWndTest[0]),

};

void WIDGET_TEST_Dlg(void)
{
	WND_WIDGET_Create(&stGlbDlgMainWndTest, 0);
}



































int WIDGET_TEST_IconViewProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "图标控件按钮被点击\n");

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(u32Wnd);
	WND_WIDGET_S *pstParentWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);

	WND_WIDGET_FlushIconCursel(pstParentWnd, u32Wnd);

	return 0;
}

int WIDGET_TEST_IconViewProc2(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "图标控件按钮被点击\n");


	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(u32Wnd);
	WND_WIDGET_S *pstParentWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);

	WND_WIDGET_FlushIconCursel(pstParentWnd, u32Wnd);

	return 0;
}


int WIDGET_TEST_IconViewProc3(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "图标控件3按钮被点击\n");


	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(u32Wnd);
	WND_WIDGET_S *pstParentWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);

	WND_WIDGET_FlushIconCursel(pstParentWnd, u32Wnd);

	return 0;
}



WND_WIDGET_S stGlbIconViewWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_ICON_VIEW_E,
		.unPrivate = {
			.stIconView = {
				.s8Name = "图标控件测试",
				.s8IconPath = "share/res/png/menu/单面画-黄.png",
				.s8IconPathCursel = "share/res/png/menu/单面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "图标控件",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_BLACK_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_IconViewProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbDlgWndTest,
		//.s32WidgetNum = sizeof(stGlbDlgWndTest) / sizeof(stGlbDlgWndTest[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_ICON_VIEW_E,
		.unPrivate = {
			.stIconView = {
				//.s8Name = "图标控件测试",
				.s8IconPath = "share/res/png/menu/单面画-黄.png",
				.s8IconPathCursel = "share/res/png/menu/单面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "图标控件2",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*3)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_BLACK_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_IconViewProc2,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbDlgWndTest,
		//.s32WidgetNum = sizeof(stGlbDlgWndTest) / sizeof(stGlbDlgWndTest[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_ICON_VIEW_E,
		.unPrivate = {
			.stIconView = {
				.s8Name = "图标控件测试2",
				.s8IconPath = "share/res/png/menu/单面画-黄.png",
				.s8IconPathCursel = "share/res/png/menu/单面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "图标控件3",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_BLACK_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_IconViewProc3,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbDlgWndTest,
		//.s32WidgetNum = sizeof(stGlbDlgWndTest) / sizeof(stGlbDlgWndTest[0]),
	},

};



WND_WIDGET_S stGlbIconViewMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "图标控件主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbIconViewWndTest,
	.s32WidgetNum = sizeof(stGlbIconViewWndTest) / sizeof(stGlbIconViewWndTest[0]),

};

void WIDGET_TEST_IconView(void)
{
	WND_WIDGET_Create(&stGlbIconViewMainWndTest, 0);
}





















int WIDGET_TEST_CtrlSetsProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "按钮被点击\n");

	/* 此回调没有效果 ，也没有用处*/


	return 0;
}





int WIDGET_TEST_DoublePictureCallBack(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	WND_WIDGET_S *pstWnd = (WND_WIDGET_S *)GetWindowAdditionalData(u32Wnd);
	if(pstWnd == NULL) {
		SLOG(TDBG, "获取到的私有数据为空\n");
	} else {
		QLOG(TDBG, "[%s]\n", pstWnd->stCommon.stAttr.s8Name);
	}

	WND_WIDGET_FlushDoublePictureButtonCursel(u32Wnd);

	return 0;
}



WND_WIDGET_S stGlbPictureButtonWndSetTest[] = {


	{
		.enType = WND_WIDGET_TYPE_DOUBLE_PIC_BUTT_E,
		.unPrivate = {
			.stDouPicButt = {
				.s8MapPath = CTRL_PATH"/""menu/单面画-黄.png",
				.s8MapPathCursel = CTRL_PATH"/""menu/单面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "单画面",
				.u32WndId = 0,
				.u32Group = WIDGET_GRP_MAIN_MENU_E,
				.u32Id = 5554,
				//.u32WndX = (UI_COORD_MAX*1)/6,
				//.u32WndY = (UI_COORD_MAX*1)/6,
				//.u32WndWidth = (UI_COORD_MAX*4)/6,
				//.u32WndHeight = (UI_COORD_MAX*4)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DoublePictureCallBack,
			},
		},
	},
	{
		.enType = WND_WIDGET_TYPE_DOUBLE_PIC_BUTT_E,
		.unPrivate = {
			.stDouPicButt = {
				.s8MapPath = CTRL_PATH"/""menu/四面画-黄.png",
				.s8MapPathCursel = CTRL_PATH"/""menu/四面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "四面画",
				.u32WndId = 0,
				.u32Group = WIDGET_GRP_MAIN_MENU_E,
				.u32Id = 5555,
				//.u32WndX = (UI_COORD_MAX*1)/6,
				//.u32WndY = (UI_COORD_MAX*1)/6,
				//.u32WndWidth = (UI_COORD_MAX*4)/6,
				//.u32WndHeight = (UI_COORD_MAX*4)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DoublePictureCallBack,
			},
		},
	},

	{
		.enType = WND_WIDGET_TYPE_DOUBLE_PIC_BUTT_E,
		.unPrivate = {
			.stDouPicButt = {
				.s8MapPath = CTRL_PATH"/""menu/九面画-黄.png",
				.s8MapPathCursel = CTRL_PATH"/""menu/九面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "九面画",
				.u32WndId = 0,
				.u32Group = WIDGET_GRP_MAIN_MENU_E,
				.u32Id = 5556,
				//.u32WndX = (UI_COORD_MAX*1)/6,
				//.u32WndY = (UI_COORD_MAX*1)/6,
				//.u32WndWidth = (UI_COORD_MAX*4)/6,
				//.u32WndHeight = (UI_COORD_MAX*4)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DoublePictureCallBack,
			},
		},
	},
};




WND_WIDGET_S stGlbCtrlSetsWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_CTRL_SETS_E,
		.unPrivate = {
			.stCtrlSets = {
				.s32Direction = 0,		/* 创建横向的*/
				.s32Left = (UI_COORD_MAX*1)/20,						/* 左 端空隙的距离*/
				.s32Right = (UI_COORD_MAX*1)/20,						/* 右 端空隙的距离*/
				.s32Top = (UI_COORD_MAX*1)/20,							/* 上 端空隙的距离*/
				.s32Bottom = (UI_COORD_MAX*1)/20,					/* 下 端空隙的距离*/
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "控件集合",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*4)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_CYAN_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_CtrlSetsProc,
			},
			//WND_STA_S stSta;
		},

		.pstWidget = stGlbPictureButtonWndSetTest,
		.s32WidgetNum = sizeof(stGlbPictureButtonWndSetTest) / sizeof(stGlbPictureButtonWndSetTest[0]),
	},
};



WND_WIDGET_S stGlbCtrlSetsMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "控件集合主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbCtrlSetsWndTest,
	.s32WidgetNum = sizeof(stGlbCtrlSetsWndTest) / sizeof(stGlbCtrlSetsWndTest[0]),

};

void WIDGET_TEST_CtrlSets(void)
{
	WND_WIDGET_Create(&stGlbCtrlSetsMainWndTest, 0);
}




















#if 0

int WIDGET_TEST_StaticPictureProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "静态图片被点击\n");

	/* 此回调没有效果 ，也没有用处*/
	WND_WIDGET_S *pstWnd = (WND_WIDGET_S *)GetWindowAdditionalData(u32Wnd);
	if(pstWnd)  {
		SLOG(TDBG, "[%s]\n", pstWnd->stCommon.stAttr.s8Name);

	} else {
		SLOG(TDBG, "没有附加数据\n");
	}

	return 0;
}
#endif

int WIDGET_TEST_StaticPictureProc(HWND hWnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{

	switch (s32Message) {

		case MSG_COMMAND:
			QLOG(TDBG, "基础设置列表\n");

		break;

		case EN_SETFOCUS:{
			QLOG(TDBG, "输入界面有变化\n");
			break;
		}


		case MSG_PAINT:
		{
			//QLOG(TDBG, "22222\n");
			HDC hdc = BeginPaint (hWnd);

			EndPaint (hWnd, hdc);


			return 0;
		}
	}
	return DefaultContainerProc(hWnd, s32Message, u32Param, u64Param);

}



WND_WIDGET_S stGlbStaticPictureWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_STATIC_PICTURE_E,
		.unPrivate = {
			.stStaticPicture= {
				.s8MapPath = "share/res/png/menu/单面画-黄.png",
				.bNotify = true,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "静态图片显示",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 5559,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_TRANSPARENT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_StaticPictureProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbIconViewWndTest,
		//.s32WidgetNum = sizeof(stGlbIconViewWndTest) / sizeof(stGlbIconViewWndTest[0]),
	},
};



WND_WIDGET_S stGlbStaticPictureMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "静态图片主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbStaticPictureWndTest,
	.s32WidgetNum = sizeof(stGlbStaticPictureWndTest) / sizeof(stGlbStaticPictureWndTest[0]),

};

void WIDGET_TEST_StaticPicture(void)
{
	WND_WIDGET_Create(&stGlbStaticPictureMainWndTest, 0);
}
















int WIDGET_TEST_ButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{

	WND_WIDGET_S *pstWnd = NULL;

	pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(u32Wnd);
	if(pstWnd) {
		SLOG(TDBG, "[%s]被点击\n", pstWnd->stCommon.stAttr.s8Name);
	}

	return 0;
}



WND_WIDGET_S stGlbListChildWndTest[] = {
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.unPrivate = {
			.stButton= {
				.enCurselBkColor = UI_COLOR_ORANGE_E,	//	选中时候的背景颜色
				.enCurselFontColor = UI_COLOR_BLACK_E,					//	选中时候的字体颜色
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮1",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 2000,
				.u64Style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_NOTIFY | SS_NOTIFY | SS_CENTER,
				//.u32WndX = (UI_COORD_MAX*1)/6,
				//.u32WndY = (UI_COORD_MAX*1)/6,
				//.u32WndWidth = (UI_COORD_MAX*1)/6,
				//.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					//.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.unPrivate = {
			.stButton= {
				.enCurselBkColor = UI_COLOR_ORANGE_E,	//	选中时候的背景颜色
				.enCurselFontColor = UI_COLOR_BLACK_E,					//	选中时候的字体颜色
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮2",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 2001,
				.u64Style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_NOTIFY | SS_NOTIFY | SS_CENTER,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					//.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.unPrivate = {
			.stButton= {
				.enCurselBkColor = UI_COLOR_ORANGE_E,	//	选中时候的背景颜色
				.enCurselFontColor = UI_COLOR_BLACK_E,					//	选中时候的字体颜色
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮3",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 2002,
				.u64Style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_NOTIFY | SS_NOTIFY | SS_CENTER,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					//.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.unPrivate = {
			.stButton= {
				.enCurselBkColor = UI_COLOR_ORANGE_E,	//	选中时候的背景颜色
				.enCurselFontColor = UI_COLOR_BLACK_E,					//	选中时候的字体颜色
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮4",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 2003,
				.u64Style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_NOTIFY | SS_NOTIFY | SS_CENTER,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					//.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.unPrivate = {
			.stButton= {
				.enCurselBkColor = UI_COLOR_ORANGE_E,	//	选中时候的背景颜色
				.enCurselFontColor = UI_COLOR_BLACK_E,					//	选中时候的字体颜色
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "按钮5",
				.u32WndId = 0,
				.u32Group = 1,
				.u32Id = 2004,
				.u64Style = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_NOTIFY | SS_NOTIFY | SS_CENTER,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*1)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					//.enFontColor = UI_COLOR_BLACK_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_ButtonProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},


};



WND_WIDGET_S stGlbListWndTest[] = {


	{
#if 1
		.enType = WND_WIDGET_TYPE_SCROLL_E,
		.unPrivate = {
			.stListMenu= {
				.s32ChildArray = 2,
				.s32Left = (UI_COORD_MAX*1)/60,						/* 左 端空隙的距离*/
				.s32Right = (UI_COORD_MAX*1)/4,						/* 右 端空隙的距离*/
				.s32Top = (UI_COORD_MAX*1)/60,							/* 上 端空隙的距离*/
				.s32Bottom = (UI_COORD_MAX*1)/50,					/* 下 端空隙的距离*/
				//.pstMenuList = stGlbBasicSetButton,
				//.s32MenuListNum = sizeof(stGlbBasicSetButton)/sizeof(stGlbBasicSetButton[0]),
				.u32Ctrlheight = (UI_COORD_MAX * 2)/8,
			},
		},
#else
		.enType = WND_WIDGET_TYPE_CTRL_SETS_E,
		.unPrivate = {
			.stCtrlSets = {
				.s32Direction = 0,		/* 创建横向的*/
			},
		},
#endif
/*
		.stCommon = {
			.stAttr = {
				.s8Name = "列表",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 5559,
				.u64Style = WS_BORDER | WS_VISIBLE | WS_VSCROLL,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*4)/6,
				.u32WndHeight = (UI_COORD_MAX*4)/6,
				.enBkColor = UI_COLOR_GREEN_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_StaticPictureProc,
			},
			//WND_STA_S stSta;
		},

		.pstWidget = stGlbListChildWndTest,
		.s32WidgetNum = sizeof(stGlbListChildWndTest) / sizeof(stGlbListChildWndTest[0]),
	},
	*/
		.stCommon = {
			.stAttr = {
				.s8Name = "列表",
				.u32WndId = 0,
				.u32Group = 0,
				//.u32ParentWndId = HWND_DESKTOP,
				.u64Style = WS_BORDER | WS_VISIBLE | WS_VSCROLL,
				//.u64Style = WS_BORDER | WS_VISIBLE,
				.u64ExStyle = WS_EX_NONE,
				.u32Id = 5558,
				.u32WndX = (UI_COORD_MAX*0)/6 + (UI_COORD_MAX*1)/60,
				.u32WndY = (UI_COORD_MAX*1)/5 + (UI_COORD_MAX*1)/15,//(UI_COORD_MAX*1)/45,
				.u32WndWidth = (UI_COORD_MAX*1)/5,
				//.u32WndHeight = (UI_COORD_MAX*14)/20,
				.u32WndHeight = UI_COORD_MAX - ((UI_COORD_MAX*1)/5 + (UI_COORD_MAX*5)/60),
				.enBkColor = UI_COLOR_MAGENTA_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_StaticPictureProc,
			},
			//WND_STA_S stSta;
		},
		.pstWidget = stGlbListChildWndTest,
		.s32WidgetNum = sizeof(stGlbListChildWndTest) / sizeof(stGlbListChildWndTest[0]),
	},
};


WND_WIDGET_S stGlbListMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "控件集合主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			//.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbListWndTest,
	.s32WidgetNum = sizeof(stGlbListWndTest) / sizeof(stGlbListWndTest[0]),

};

void WIDGET_TEST_List(void)
{
	WND_WIDGET_Create(&stGlbListMainWndTest, 0);
}

























WND_WIDGET_S stGlbLayoutChildWndTest[] = {


	{
		.enType = WND_WIDGET_TYPE_STATIC_PICTURE_E,
		.unPrivate = {
			.stStaticPicture= {
				.s8MapPath = "share/res/png/menu/单面画-黄.png",
				.bNotify = true,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "静态图片显示1",
				.u32WndId = 0,
				//.u32Group = 2,
				.u32Id = 5560,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_TRANSPARENT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_StaticPictureProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbIconViewWndTest,
		//.s32WidgetNum = sizeof(stGlbIconViewWndTest) / sizeof(stGlbIconViewWndTest[0]),
	},
	{
		.enType = WND_WIDGET_TYPE_STATIC_PICTURE_E,
		.unPrivate = {
			.stStaticPicture= {
				.s8MapPath = "share/res/png/menu/单面画-黄.png",
				.bNotify = true,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "静态图片显示2",
				.u32WndId = 0,
				//.u32Group = 2,
				.u32Id = 5560,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*3)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*2)/6,
				.enBkColor = UI_COLOR_TRANSPARENT_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_StaticPictureProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbIconViewWndTest,
		//.s32WidgetNum = sizeof(stGlbIconViewWndTest) / sizeof(stGlbIconViewWndTest[0]),
	},
};






WND_WIDGET_S stGlbLayoutWndTest[] = {

	{
		.enType = WND_WIDGET_TYPE_LAYOUT_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "画布",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 5559,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*4)/6,
				.u32WndHeight = (UI_COORD_MAX*4)/6,
				.enBkColor = UI_COLOR_BLACK_E,
				.bShowNow = true,
				.bBorder = true,
			},
			.stFops = {
				//.CallBack = WIDGET_TEST_StaticPictureProc,
			},
			//WND_STA_S stSta;
		},

		.pstWidget = stGlbLayoutChildWndTest,
		.s32WidgetNum = sizeof(stGlbLayoutChildWndTest) / sizeof(stGlbLayoutChildWndTest[0]),
	},
};



WND_WIDGET_S stGlbLayoutMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "画布主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			//.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbLayoutWndTest,
	.s32WidgetNum = sizeof(stGlbLayoutWndTest) / sizeof(stGlbLayoutWndTest[0]),

};

void WIDGET_TEST_Layout(void)
{
	WND_WIDGET_Create(&stGlbLayoutMainWndTest, 0);
}










































int WIDGET_TEST_DoublePictureButtonProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "---------双图片按钮要被点击\n");
	int s32Num = 24;
	int s32Vale;
	s32Vale = sqrt(s32Num);
	SLOG(TDBG, "-----------开方为：%d\n", s32Vale);

	/* 此回调没有效果 ，也没有用处*/
	WND_WIDGET_DoublePictureButtonShow(u32Wnd);



	return 0;
}



WND_WIDGET_S stGlbDoublePictureButtonWndTest[] = {


	{

		.enType = WND_WIDGET_TYPE_DOUBLE_PIC_BUTT_E,
		.unPrivate = {
			.stDouPicButt = {
				.s8MapPath = "share/res/png/menu/单面画-黄.png",
				.s8MapPathCursel = "share/res/png/menu/单面画.png",
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "双图片按钮",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 5559,
				.u32WndX = (UI_COORD_MAX*1)/6,
				.u32WndY = (UI_COORD_MAX*1)/6,
				.u32WndWidth = (UI_COORD_MAX*4)/6,
				.u32WndHeight = (UI_COORD_MAX*4)/6,
				.enBkColor = UI_COLOR_BLACK_E,
				.bShowNow = true,
				//.bBorder = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DoublePictureButtonProc,
			},
			//WND_STA_S stSta;
		},

		.pstWidget = stGlbLayoutChildWndTest,
		.s32WidgetNum = sizeof(stGlbLayoutChildWndTest) / sizeof(stGlbLayoutChildWndTest[0]),
	},
};


WND_WIDGET_S stGlbDoublePicButtMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "双图片按钮主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			//.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbDoublePictureButtonWndTest,
	.s32WidgetNum = sizeof(stGlbDoublePictureButtonWndTest) / sizeof(stGlbDoublePictureButtonWndTest[0]),

};



void WIDGET_TEST_DoublePictureButton(void)
{
	WND_WIDGET_Create(&stGlbDoublePicButtMainWndTest, 0);
}
























int WIDGET_TEST_DropDownProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "下拉列表\n");



	return 0;
}


WIDGET_DROP_DOWN_ITM_S stGlbDropDownItm[] = {
	{.ps8Name = "点火"},
	{.ps8Name = "定时"},
	{.ps8Name = "点火或定时"},
};




WND_WIDGET_S stGlbDropDownCtrlWndTest[] = {

	{
		.enType = WND_WIDGET_TYPE_DROP_DOWN_E,
		.unPrivate = {
			.stDropDown = {
				.s32ListHeight = (UI_COORD_MAX * 1)/6,
				.pstItm = stGlbDropDownItm,
				.s32Num = sizeof(stGlbDropDownItm)/sizeof(stGlbDropDownItm[0]),
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "",
				.u32WndId = 0,
				.u32Group = 0,
				//.u32ParentWndId = HWND_DESKTOP,
				//.u64Style = WS_CHILD | WS_VISIBLE |WS_BORDER,
				.u64ExStyle = WS_EX_NONE,
				//.u32Id = IDC_SET_STAR_UP_MODE,
				.u32WndX = (UI_COORD_MAX * 1)/6,
				.u32WndY = (UI_COORD_MAX * 3)/5,
				.u32WndWidth = (UI_COORD_MAX * 2)/6,
				.u32WndHeight = (UI_COORD_MAX * 1)/10,
				.enBkColor = UI_COLOR_DEFAULT_E,
				.bShowNow = true,
			},
			.stFops = {
				.CallBack = WIDGET_TEST_DropDownProc,
			},
		},
	},
};








WND_WIDGET_S stGlbDropDownMainWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "下拉列表主界面主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			//.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbDropDownCtrlWndTest,
	.s32WidgetNum = sizeof(stGlbDropDownCtrlWndTest) / sizeof(stGlbDropDownCtrlWndTest[0]),

};



void WIDGET_TEST_DropDown(void)
{
	WND_WIDGET_Create(&stGlbDropDownMainWndTest, 0);
}
















int WIDGET_TEST_EditProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{

	SLOG(TDBG, "编辑框 [0x%x] [0x%x] \n", s32Message, u32Param);
	//int id = LOWORD (u32Param);
	//int code = HIWORD (u32Param);

	//if(EN_SETFOCUS == id) {
	//	SLOG(TDBG, "编辑框 获得到了光标\n");
	//}
	int id = 0;
	int code = 0;

	id = LOWORD (u32Param);
	code = HIWORD (u32Param);

	switch(id) {
		case EN_KILLFOCUS:
			QLOG(TDBG, "隐藏 键盘\n");
			ShowWindow(stGlbMainWndHandle.u32SoftKeyWndId, SW_HIDE);
			return 0;
		case EN_SETFOCUS:
			QLOG(TDBG, "显示键盘\n");
			ShowWindow(stGlbMainWndHandle.u32SoftKeyWndId, SW_SHOWNORMAL);
			return 0;
	}


	return 0;
}


int WIDGET_TEST_GetEditTextProc(HWND u32Wnd, int s32Message, WPARAM u32Param, LPARAM u64Param)
{
	SLOG(TDBG, "获取状态按钮被点击\n");
	int s32Num;
	int s32MultiSta;
	char s8TempBuf[125];

	WND_WIDGET_S *pstWnd = (WND_WIDGET_S*)GetWindowAdditionalData(GetParent(u32Wnd));
	if(pstWnd == NULL) {
		SLOG(ERR, "获取窗口结构体失败\n");
		return -1;
	}
	SLOG(TDBG, "获取到 [%s] 的结构体\n", pstWnd->stCommon.stAttr.s8Name);


	for(s32Num = 0; s32Num < pstWnd->s32WidgetNum; s32Num++) {
		if(pstWnd->pstWidget[s32Num].enType == WND_WIDGET_TYPE_EDIT_E) {
			MINI_INTF_GetWindowText(pstWnd->pstWidget[s32Num].stCommon.stAttr.u32WndId, s8TempBuf, sizeof(s8TempBuf));
			SLOG(TDBG, "获取到编辑框数据 [%s] \n", s8TempBuf);
		}
	}

	return 0;
}


WND_WIDGET_S stGlbEditCtrlWndTest[] = {

	{
		.enType = WND_WIDGET_TYPE_EDIT_E,
		.unPrivate = {
			.stEdit = {
				.u32Type = 0,
			},
		},
		.stCommon = {
			.stAttr = {
				.s8Name = "",
				.u32WndId = 1120,
				.u32Group = 0,
				//.u32ParentWndId = HWND_DESKTOP,
				//.u64Style = WS_CHILD | WS_VISIBLE |WS_BORDER,
				.u64ExStyle = WS_EX_NONE,
				.u32Id = 226,
				.u32WndX = (UI_COORD_MAX * 1)/6,
				.u32WndY = (UI_COORD_MAX * 3)/5,
				.u32WndWidth = (UI_COORD_MAX * 2)/6,
				.u32WndHeight = (UI_COORD_MAX * 1)/10,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_EditProc,
			},
		},
	},
	{
		.enType = WND_WIDGET_TYPE_BUTTON_E,
		.stCommon = {
			.stAttr = {
				.s8Name = "获取编辑框",
				.u32WndId = 0,
				.u32Group = 2,
				.u32Id = 0,
				.u32WndX = (UI_COORD_MAX*3)/6,
				.u32WndY = (UI_COORD_MAX*2)/6,
				.u32WndWidth = (UI_COORD_MAX*2)/6,
				.u32WndHeight = (UI_COORD_MAX*1)/6,
				.enBkColor = UI_COLOR_LIGHTWHITE_E,
				.bShowNow = true,
				.bBorder = true,
				.stFont = {
					.enFontColor = UI_COLOR_RED_E,
				},
			},
			.stFops = {
				.CallBack = WIDGET_TEST_GetEditTextProc,
			},
			//WND_STA_S stSta;
		},

		//.pstWidget = stGlbMainWndCtrl,
		//.s32WidgetNum = sizeof(stGlbMainWndCtrl) / sizeof(stGlbMainWndCtrl[0]),
	},
};


WND_WIDGET_S stGlbEditWndTest = {
	.enType = WND_WIDGET_TYPE_MAIN_E,
	.stCommon = {
		.stAttr = {
			.s8Name = "编辑框主界面",
			.u32WndId = 0,
			.u32Group = 1,
			.u32Id = 0,
			.u32WndX = 0,
			.u32WndY = 0,
			.u32WndWidth = UI_COORD_MAX,
			.u32WndHeight = UI_COORD_MAX,
			.enBkColor = UI_COLOR_BLACK_E,
			.bShowNow = true,
			.bBorder = true,
		},
		.stFops = {
			.CallBack = WIDGET_TEST_MainPRoc,
		},
		//WND_STA_S stSta;
	},

	.pstWidget = stGlbEditCtrlWndTest,
	.s32WidgetNum = sizeof(stGlbEditCtrlWndTest) / sizeof(stGlbEditCtrlWndTest[0]),

};



void WIDGET_TEST_Edit(void)
{
	WND_WIDGET_Create(&stGlbEditWndTest, 0);
}













void WIDGET_TEST_Start(void)
{
	SLOG(TDBG, "测试minigui部件\n");
	int s32Type;



		QLOG(TDBG, "创建键盘\n");

	//mgiAddIMEWindow (ime_handle, u32SoftKeypadWnd, "softkeyboard");
	stGlbMainWndHandle.u32SoftKeyWndId = mgiCreateSoftKeypad(NULL);
	//SetIMEStatus(IME_STATUS_AUTOTRACK, TRUE);
	SetIMEStatus(IME_STATUS_ENCODING, IME_ENCODING_UTF8);
	SetIMEStatus(IME_STATUS_ENABLED, TRUE);

	// 获取屏幕宽度
	stGlbMainWndHandle.s32ScreenWidth = GetGDCapability(HDC_SCREEN,GDCAP_HPIXEL) - 10;
	stGlbMainWndHandle.s32ScreenHeight = GetGDCapability(HDC_SCREEN,GDCAP_VPIXEL) - 5;

	WND_WIDGET_InitFont(&stGlbMainWndHandle.stDefaultFont);

	QLOG(DBG, "获取到屏幕尺寸 宽[%d] 高[%d]\n", stGlbMainWndHandle.s32ScreenWidth, stGlbMainWndHandle.s32ScreenHeight);

	do {
		MINI_INPUT_GetInt(&s32Type, "选择需要测试的功能 :\n\
1.主窗口\n\
2.按钮\n\
3.图片按钮\n\
4.多选按钮\n\
5.单选按钮\n\
6.对话框\n\
7.图标控件\n\
8.控件集合\n\
9.静态图片显示\n\
10.列表\n\
11.画布\n\
12.双图片按钮\n\
13.下拉列表\n\
14.编辑框\n\
0.退出\n:");

		if(s32Type == 1) {
			WIDGET_TEST_MainWnd();
		} else if(s32Type == 2) {
			WIDGET_TEST_Button();
		} else if(s32Type == 3) {
			WIDGET_TEST_PictureButton();
		} else if(s32Type == 4) {
			WIDGET_TEST_MultiButton();
		}else if(s32Type == 5) {
			WIDGET_TEST_RadioButton();
		} else if(s32Type == 6) {
			WIDGET_TEST_Dlg();
		} else if(s32Type == 7) {
			WIDGET_TEST_IconView();
		} else if(s32Type == 8) {
			WIDGET_TEST_CtrlSets();
		} else if(s32Type == 9) {
			WIDGET_TEST_StaticPicture();
		} else if(s32Type == 10) {
			WIDGET_TEST_List();
		} else if(s32Type == 11) {
			WIDGET_TEST_Layout();
		} else if(s32Type == 12) {
			WIDGET_TEST_DoublePictureButton();
		} else if(s32Type == 13) {
			WIDGET_TEST_DropDown();
		} else if(s32Type == 14) {
			WIDGET_TEST_Edit();
		}else if(s32Type == 0) {
			return;
		} else {
			SLOG(DBG, "无效的输入参数!!!!\n");
			s32Type = 0;
		}
	} while(0);

}


